package com.shudes.eval;

import com.shudes.game.*;
import com.shudes.util.*;

public class EquityResultInspector {

	protected EquityResult equityResult;
	
	public EquityResultInspector(EquityResult er) { 
		equityResult=er;
	}
	
	public Money getEquity(HoleCards hc) { 
		EquityResult.Counts counts;
		Money m;
		
		counts=equityResult.getCounts(hc); 		
		m = new Money(counts.getWin()); 
		return m.divide(new Money(counts.getTotal()));
	}
	
	public String toTwoDimes() { 
		EquityResult.Counts counts; 
		String r;
		
		r = "equity. board " + equityResult.getBoard();
		if(equityResult.getDeadCards()!=null && equityResult.getDeadCards().size()>0) { 
			r += ", dead " + equityResult.getDeadCards();
		}
		r += "\n";
		
		for(HoleCards hc : equityResult.getCountsMap().keySet()) {
			counts = equityResult.getCounts(hc); 
			r += "\t " + hc + " (" + counts.getWin() + "," + counts.getLoss() + ", " + counts.getTie() + ")\t" + getEquity(hc).toString(4,false,false) + "\n";
		}
		
	
		return r; 
	}
	
}
